package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.PaymentRequestConfig;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.iservice.generic.CRUDServiceAsync;

import java.util.List;

/**
 * Created by jose on 29/01/15.
 */
public interface PaymentRequestServiceAsync extends CRUDServiceAsync {

    void save(PaymentRequestConfig entity, AsyncCallback<PaymentRequestConfig> async);

    void getByEnterprise(AsyncCallback<PaymentRequestConfig> async);

    void getNumberOfInstallmentsForRequestBetween(PaymentRequestConfig paymentRequestConfig, AsyncCallback<List<Integer>> async);

    void copyPaymentRequestConfig(Enterprise parentEnterprise, Enterprise newEnterprise, AsyncCallback<Void> async);

    public static final class Util {
        private static PaymentRequestServiceAsync instance;

        public static final PaymentRequestServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(PaymentRequestService.class);
            }
            return instance;
        }
    }

}
